<template>
  <div class="all" ref="all">
    <div class="header">
      <div class="img-box" @click.stop="hideScreenHandler">
        <img src="@/../public/images/1671862942776.png" alt="" />
      </div>
      <div class="text">筛选</div>
    </div>
    <div class="content">
      <div class="content-item" v-for="(item, index) in list" :key="index">
        <div class="title">{{ item.title }}</div>
        <div class="item">
          <div class="select-all">全部</div>
          <div class="tag" v-for="(tag, index) in item.tags" :key="index">
            {{ tag }}
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "ScreeningComponent",
  props: {
    isShowScreen: {
      type: Boolean,
      default: false,
    },
  },
  data: () => {
    return {
      list: [
        {
          title: "行业",
          tags: [
            "互联网",
            "游戏",
            "全部",
            "互联网",
            "游戏",
            "全部",
            "互联网",
            "游戏",
          ],
        },
        {
          title: "行业",
          tags: [
            "互联网",
            "游戏",
            "全部",
            "互联网",
            "游戏",
            "全部",
            "互联网",
            "游戏",
          ],
        },
        {
          title: "行业",
          tags: [
            "互联网",
            "游戏",
            "全部",
            "互联网",
            "游戏",
            "全部",
            "互联网",
            "游戏",
          ],
        },{
          title: "行业",
          tags: [
            "互联网",
            "游戏",
            "全部",
            "互联网",
            "游戏",
            "全部",
            "互联网",
            "游戏",
          ],
        },
      ],
    };
  },
  watch: {
    isShowScreen(val) {
      if (val) {
        this.$refs.all.style.left = "0";
      } else {
        this.$refs.all.style.left = "100vw";
      }
    },
  },
  methods: {
    hideScreenHandler(tag) {
      this.$emit("callScreeningHandler",{tag});
    },
  },
};
</script>

<style lang="scss" scoped>
.all {
  overflow: scroll;
  position: fixed;
  left: 100vw;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: #fff;
  z-index: 100;
  transition: 0.5s;
  .header {
    position: sticky;
    left: 0;
    top: 0;
    width: 100%;
    height: 1rem;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding: 0 0.3rem;
    font-size: 0.36rem;
    font-weight: bold;
    color: #333333;
    background-color: #fff;
    .img-box {
      width: 0.28rem;
      min-width: 0.28rem;
      height: 0.27rem;
    }
    .text {
      flex-grow: 1;
      text-align: center;
    }
  }
  .content {
    width: 100%;
    font-size: 0.3rem;
    color: #333;
    box-sizing: border-box;
    width: 6.9rem;
    margin: 0 auto;
    .content-item {
      .title {
        text-align: start;
        font-size: 0.36rem;
        font-weight: bold;
        color: #333333;
        margin: 0.3rem 0;
      }
      .item {
        display: flex;
        flex-wrap: wrap;
        > div {
          width: 2.1rem;
          height: 0.7rem;
          background: #ffffff;
          box-shadow: 0px 0px 0.07rem 0px rgba(20, 150, 57, 0.35);
          border-radius: 0.2rem;
          display: flex;
          justify-content: center;
          align-items: center;
          margin-right: 0.3rem;
          margin-bottom: 0.2rem;
          &:nth-child(3n) {
            margin-right: 0;
          }
        }
        .tag {
          background: #eeeeee;
          box-shadow: none;
        }
      }
    }
  }
}
</style>